package com.tcc.naozhongservice;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;

// 接收闹钟事件
public class AlarmInitReceiver extends BroadcastReceiver {
    @Override
    public void onReceive(Context context, Intent intent) {
        String action = intent.getAction();
        if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
            //开机启动service
            Intent myintent = new Intent(context, SystemService.class);
            myintent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startService(myintent);

        } else {
            //跳转到提醒页
            Intent newIntent = new Intent();
            newIntent.putExtra("cInfo", intent.getStringArrayExtra("cInfo"));
            newIntent.setClass(context, AlarmAlert.class);
            newIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(newIntent);
        }
    }


}
